package com.fhc;

import java.io.*;
import java.util.*;
import java.math.*;

import com.vladimirjosu.util.Util;

public class Card implements Runnable {
	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer st;
	static Random rnd;

	final long modulo = 1000000007;

	void solve() throws IOException {
		int tests = nextInt();

		for (int test = 1; test <= tests; test++) {
			solveOne(test);
		}
	}

	private long rightModulo(long n) {
		n %= modulo;
		n += modulo;
		n %= modulo;
		return n;
	}

	private long modInverse(long n) {
		n = rightModulo(n);
		long res = BigInteger.valueOf(n).modInverse(BigInteger.valueOf(modulo))
				.longValue();
		res = rightModulo(res);
		return res;
	}

	private long C(int n, int k, long[] factorials, long[] factorialsRev) {
		long top = factorials[n];
		long bottom = rightModulo(factorialsRev[k] * factorialsRev[n - k]);
		// long bottom = factorials[k] * factorials[n - k];
		// return top / bottom;
		return rightModulo(top * bottom);
	}

	private void solveOne(int test) throws IOException {
		int n = nextInt(), k = nextInt();

		long[] factorials = new long[n + 1], factorialsRev = new long[n + 1];
		factorials[0] = factorials[1] = 1;

		for (int i = 2; i <= n; i++) {
			factorials[i] = rightModulo(factorials[i - 1] * i);
		}

		for (int i = 0; i <= n; i++) {
			factorialsRev[i] = modInverse(factorials[i]);
		}

		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextLong();
		}
		Arrays.sort(arr);

		long res = 0;

		for (int i = n - 1; i >= 0; i--) {
			int leftSize = i, canSize = leftSize + 1;

			if (canSize >= k) {
				long leftWays = C(leftSize, k - 1, factorials, factorialsRev);
				long realValue = rightModulo(arr[i]);

				// out.println(i + " " + leftSize + " " + (k - 1) + " " + arr[i]
				// + " " + leftWays);

				res += rightModulo(leftWays * realValue);
				res = rightModulo(res);
			}
		}

		out.println("Case #" + test + ": " + res);

	}

	public static void main(String[] args) {
		new Card().run();
	}

	public void run() {
		try {
			final String className = this.getClass().getName().toLowerCase();

			try {
				in = new BufferedReader(
						new InputStreamReader(
								Util.getSourceStream("input.txt")));
//				in = new BufferedReader(new FileReader(className + ".in"));
				out = new PrintWriter(new FileWriter("output/" + className + ".out"));
				// in = new BufferedReader(new FileReader("input.txt"));
				// out = new PrintWriter(new FileWriter("output.txt"));
			} catch (FileNotFoundException e) {
				in = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			}

			rnd = new Random();

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(42);
		}
	}

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = in.readLine();

			if (line == null)
				return null;

			st = new StringTokenizer(line);
		}

		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}